< previous page page_48 next page >

Page 48
that the revised Top and Left properties aren't automatically displayed in the Label controls. This result is due to the fact that the code to update the labels is contained in the form's Resize event procedure, and the form wasn't resized when you moved it. Unfortunately, no event is similar to a Resize event that occurs when a form is repositioned. This problem can be overcome, of course; however, the solution is beyond the scope of this chapter. For now, you can "manually" update the labels by resizing the form just after you've moved it, allowing you to see the updated Top and Left properties.
Using Properties to Control User Interaction
Even if your application includes many forms and controls, you probably don't want the users to have access to all of them at the same time. For example, suppose you are writing a program that allows users to enter expense reports. You might have a command to allow the users to print the expense reports, but you would not want the command to be available unless the reports balance. Two properties, the Visible property and the Enabled property, help you to manage this process.
The Visible property determines whether an object can be seen on the screen. The Enabled property determines whether the users can interact with an object. You can set both properties to either True or False.
If the Visible property is set to False, the object is not shown, and the users will not know that the object is even there. If the Enabled property is set to False, the object is visible (provided that the Visible property is True), but the users cannot use it. Typically, if an object is disabled, it is shown on the screen in a grayed-out, or dimmed, mode. This mode provides a visual indication that the object is unavailable.
A good example of objects that are variably available and unavailable occurs in the wizard interface in some Windows programs. A wizard organizes a task into several logical steps, with three navigation buttons (typically labeled Back, Next, and Finish), which are used to move between steps. Depending on which step a user is currently working on, all these buttons may not be enabled, as in Figure 3.9.
0048-01.jpg
Figure 3.9
Because the user of this wizard is on step 1,
the 
Enabled property of the Back button
is set to 
False, causing it to be grayed out.
tip.gif
If you are implementing a wizard interface in Visual Basic, one option is to draw the controls for each step in a frame. Visual Basic's Frame control acts as a container, so setting its own Visible property relevant to the user's current step affects all the controls within it.

 
< previous page page_48 next page >